package com.itheima.homework.homework01;

//子类
public class Student extends Person{

    private String school; // 所在学校

    // 构造方法不能被继承. 子类的构造需要独立给出
    public Student() {
    }

    public Student(String name, int age, String birthday, String school) {
        super(name, age, birthday);
        this.school = school;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    // 获取信息的方法
    @Override
    public String getInfo() {
        //对于父类的私有成员,子类中要想使用必须通过从父类中继承到的非私有get/set去操作
        return "Student[name=" + super.getName() + ", age=" + super.getAge() + ", birthday=" + super.getBirthday() + ", school=" + school + "]";
    }
}
